package com.qinglian.handler;

import com.qinglian.exception.TokenAuthExpiredException;
import com.qinglian.utils.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

@Slf4j
@ControllerAdvice
public class GlobalExceptionHandler {
    /**
     * 用户 token 过期
     * @return
     */
    @ExceptionHandler(value = TokenAuthExpiredException.class)
    @ResponseBody
    public Result<?> tokenExpiredExceptionHandler(){
        return Result.error("-1","用户token无效");
    }
}
